home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagn_r.zip / PRINTING.SWG / 0013_PRINTER7.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  62 lines

  1. {Your're in luck, I just got a new Printer and started writing routines to
  2. control it (TFDD etc..). These are probably the most important ones:
  3.  
  4.  
  5.  
  6.  note: This routines are not throughly tested on Various Printers.
  7.        Thus it may of may not work on your Type of Printer.
  8.        But, as a rule, experiment With it and have fun............}
  9.  
  10. Uses
  11.   Dos;
  12.  
  13. Functio PrinterOutofPaper( Port : Byte): Boolean;
  14. Var
  15.   Regs : Registers;
  16. begin
  17.   Regs.AH := $02;
  18.   Regs.DX := Port;          { 0=LPT1,  1=LPT2,  2=LPT3 }
  19.   Intr($17, Regs);          { Print Service Please }
  20.   PrinterOutofPaper := (Regs.AH and $20 = $20)
  21. end;
  22.  
  23. Function PrinterReady( Port : Byte): Boolean;
  24. Var
  25.   Regs : Registers;
  26. begin
  27.   With Regs Do
  28.     begin
  29.       AH := $02;
  30.       DX := Port;          { 0=LPT1,  1=LPT2,  2=LPT3 }
  31.       Intr($17, Regs)
  32.       PrinterReady := (AH and $80 = $80) and       { Printer Busy?   }
  33.                       (AH and $10 = $10) and       { Printer Online? }
  34.                       (AH and $08 = $00)           { Printer Error?  }
  35.      end
  36. end;
  37.  
  38. Procedure PrintChar(Port: Byte; Ch: Char);
  39. Var
  40.   Regs : Registers;
  41. begin
  42.   With Regs Do
  43.     begin
  44.       AL := ord(Ch);             { Char to print            }
  45.       DX := Port;                { 0=LPT1,  1=LPT2,  2=LPT3 }
  46.       AH := $00;                 { Print Char Service       }
  47.       Intr($17, Regs);           { Call Bios                }
  48.     end
  49. end;
  50.  
  51. Procedure BootPrinter( Port: Byte);
  52.  { Initializes IBM- or EPSON- Compatible Printer  }
  53.  { Other Printers may not understand this command }
  54.  { and may produce unwanted results               }
  55. Var
  56.   Regs : Registers;
  57. begin
  58.   Regs.DX := Port;                { 0=LPT1,  1=LPT2,  2=LPT3 }
  59.   Regs.AH := $01;
  60.   Intr($17, Regs)
  61. end;
  62.